package cn.tedu.tmall.admin.content.controller;

import cn.tedu.tmall.admin.content.pojo.param.CategoryAddParam;
import cn.tedu.tmall.admin.content.service.ICategoryService;
import cn.tedu.tmall.common.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学茶网-管理端-类别控制器
 */
@Slf4j
@Api(tags = "管理端类别模块")
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private ICategoryService categoryService;

    /**
     * 新增类别
     * @param categoryAddParam 类别详情
     */
    @ApiOperation(value = "新增类别")
    @PostMapping("/add")
    public JsonResult addCategory(@RequestBody @Validated CategoryAddParam categoryAddParam){
        log.debug("Controller-增加类别-入参:{}",categoryAddParam);
        categoryService.addCategory(categoryAddParam);
        log.debug("Controller-出参:{}", JsonResult.ok());
        return JsonResult.ok();
    }
}
